<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Make Controller Kit - Firmware API: xbee.h Source File</title>
<link href="mt_doxygen.css" rel="stylesheet" type="text/css" />
<link href="../resources/mt_doxytabs.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.header {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 12pt;
	color: #222222;
}
-->
</style>
</head>

<body>
<table width="800" border="0">
    <tr>
      <td colspan="3">
        <form method="get" action="http://www.google.com/search">
          <div align="right">
            <input type="text"   name="q" size="25"
              maxlength="255" value="" />
            <input type="submit" value="Search" />
            <input type="hidden" name="sitesearch" value="makingthings.com/ref/firmware/html" />
          </div>
        </form>
       </td>
    </tr>
    <tr>
      <td><div align="center"><a href="http://www.makingthings.com">
				<img src="../resources/logo_brown_medium.png" alt="MakingThings"
									width="200" height="78" border="0" align="middle" longdesc="http://www.makingthings.com" /></a></div></td>
				<td><div align="center" class="header">
      		Make Controller Kit <br />
          Firmware API
      </div></td>
      <td><div align="center"><a href="http://www.makezine.com">
					<img src="../resources/make_logo.png" alt="MAKE Zine" 
										width="164" height="73" border="0" align="middle" longdesc="http://www.makezine.com" /></a></div></td>
    </tr>
</table>
</body>
</html>
<!-- Generated by Doxygen 1.5.4 -->
<script type="text/javascript">
<!--
function changeDisplayState (e){
  var num=this.id.replace(/[^[0-9]/g,'');
  var button=this.firstChild;
  var sectionDiv=document.getElementById('dynsection'+num);
  if (sectionDiv.style.display=='none'||sectionDiv.style.display==''){
    sectionDiv.style.display='block';
    button.src='open.gif';
  }else{
    sectionDiv.style.display='none';
    button.src='closed.gif';
  }
}
function initDynSections(){
  var divs=document.getElementsByTagName('div');
  var sectionCounter=1;
  for(var i=0;i<divs.length-1;i++){
    if(divs[i].className=='dynheader'&&divs[i+1].className=='dynsection'){
      var header=divs[i];
      var section=divs[i+1];
      var button=header.firstChild;
      if (button!='IMG'){
        divs[i].insertBefore(document.createTextNode(' '),divs[i].firstChild);
        button=document.createElement('img');
        divs[i].insertBefore(button,divs[i].firstChild);
      }
      header.style.cursor='pointer';
      header.onclick=changeDisplayState;
      header.id='dynheader'+sectionCounter;
      button.src='closed.gif';
      section.id='dynsection'+sectionCounter;
      section.style.display='none';
      section.style.marginLeft='14px';
      sectionCounter++;
    }
  }
}
window.onload = initDynSections;
-->
</script>
<div class="tabs">
  <ul>
    <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
    <li><a href="modules.html"><span>Modules</span></a></li>
    <li><a href="classes.html"><span>Data&nbsp;Structures</span></a></li>
    <li class="current"><a href="files.html"><span>Files</span></a></li>
    <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
  </ul>
</div>
<h1>xbee.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*********************************************************************************</span>
<a name="l00002"></a>00002 <span class="comment"></span>
<a name="l00003"></a>00003 <span class="comment"> Copyright 2006 MakingThings</span>
<a name="l00004"></a>00004 <span class="comment"></span>
<a name="l00005"></a>00005 <span class="comment"> Licensed under the Apache License, </span>
<a name="l00006"></a>00006 <span class="comment"> Version 2.0 (the "License"); you may not use this file except in compliance </span>
<a name="l00007"></a>00007 <span class="comment"> with the License. You may obtain a copy of the License at</span>
<a name="l00008"></a>00008 <span class="comment"></span>
<a name="l00009"></a>00009 <span class="comment"> http://www.apache.org/licenses/LICENSE-2.0 </span>
<a name="l00010"></a>00010 <span class="comment"> </span>
<a name="l00011"></a>00011 <span class="comment"> Unless required by applicable law or agreed to in writing, software distributed</span>
<a name="l00012"></a>00012 <span class="comment"> under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR</span>
<a name="l00013"></a>00013 <span class="comment"> CONDITIONS OF ANY KIND, either express or implied. See the License for</span>
<a name="l00014"></a>00014 <span class="comment"> the specific language governing permissions and limitations under the License.</span>
<a name="l00015"></a>00015 <span class="comment"></span>
<a name="l00016"></a>00016 <span class="comment">*********************************************************************************/</span>
<a name="l00017"></a>00017 
<a name="l00018"></a>00018 <span class="comment">/*</span>
<a name="l00019"></a>00019 <span class="comment">  xbee.h</span>
<a name="l00020"></a>00020 <span class="comment">  MakingThings</span>
<a name="l00021"></a>00021 <span class="comment">*/</span>
<a name="l00022"></a>00022 
<a name="l00023"></a>00023 <span class="preprocessor">#ifndef XBEE_H</span>
<a name="l00024"></a>00024 <span class="preprocessor"></span><span class="preprocessor">#define XBEE_H</span>
<a name="l00025"></a>00025 <span class="preprocessor"></span>
<a name="l00026"></a>00026 <span class="preprocessor">#include "types.h"</span>
<a name="l00027"></a>00027 
<a name="l00028"></a>00028 <span class="comment">// states for receiving packets</span>
<a name="l00029"></a>00029 <span class="preprocessor">#define XBEE_PACKET_RX_START 0</span>
<a name="l00030"></a>00030 <span class="preprocessor"></span><span class="preprocessor">#define XBEE_PACKET_RX_LENGTH_1 1</span>
<a name="l00031"></a>00031 <span class="preprocessor"></span><span class="preprocessor">#define XBEE_PACKET_RX_LENGTH_2 2</span>
<a name="l00032"></a>00032 <span class="preprocessor"></span><span class="preprocessor">#define XBEE_PACKET_RX_PAYLOAD 3</span>
<a name="l00033"></a>00033 <span class="preprocessor"></span><span class="preprocessor">#define XBEE_PACKET_RX_CRC 4</span>
<a name="l00034"></a>00034 <span class="preprocessor"></span>
<a name="l00035"></a>00035 <span class="comment">// general xbee constants</span>
<a name="l00036"></a>00036 <span class="preprocessor">#define XBEE_PACKET_STARTBYTE 0x7E</span>
<a name="l00037"></a>00037 <span class="preprocessor"></span><span class="preprocessor">#define XBEE_PACKET_ESCAPE 0x7D</span>
<a name="l00038"></a>00038 <span class="preprocessor"></span><span class="preprocessor">#define XBEE_INPUTS 15 // counts analog and digital ins separately</span>
<a name="l00039"></a>00039 <span class="preprocessor"></span><span class="preprocessor">#define XBEE_MAX_PACKET_SIZE 100</span>
<a name="l00040"></a>00040 <span class="preprocessor"></span>
<a name="l00041"></a>00041 <span class="comment">// xbee io options</span>
<a name="l00042"></a>00042 <span class="preprocessor">#define XBEE_IO_DISABLED 0</span>
<a name="l00043"></a>00043 <span class="preprocessor"></span><span class="preprocessor">#define XBEE_IO_ANALOGIN 2</span>
<a name="l00044"></a>00044 <span class="preprocessor"></span><span class="preprocessor">#define XBEE_IO_DIGITALIN 3</span>
<a name="l00045"></a>00045 <span class="preprocessor"></span><span class="preprocessor">#define XBEE_IO_DIGOUT_HIGH 4</span>
<a name="l00046"></a>00046 <span class="preprocessor"></span><span class="preprocessor">#define XBEE_IO_DIGOUT_LOW 5</span>
<a name="l00047"></a>00047 <span class="preprocessor"></span><span class="comment"></span>
<a name="l00048"></a>00048 <span class="comment">/** \defgroup XBeePacketTypes XBee Packet Types</span>
<a name="l00049"></a>00049 <span class="comment">  The different types of packet that can be used with the \ref XBee subsystem.</span>
<a name="l00050"></a>00050 <span class="comment"></span>
<a name="l00051"></a>00051 <span class="comment">  These structures are to be used when the module has already been set into packet (API) mode</span>
<a name="l00052"></a>00052 <span class="comment">  with a call to XBee_SetPacketApiMode( )</span>
<a name="l00053"></a>00053 <span class="comment"></span>
<a name="l00054"></a>00054 <span class="comment">  \ingroup XBee</span>
<a name="l00055"></a>00055 <span class="comment">  @{</span>
<a name="l00056"></a>00056 <span class="comment">*/</span>
<a name="l00057"></a>00057 <span class="comment"></span>
<a name="l00058"></a>00058 <span class="comment">/**</span>
<a name="l00059"></a>00059 <span class="comment">  The structure used for a standard AT Command packet.</span>
<a name="l00060"></a>00060 <span class="comment">  - \b frameID is the ID for this packet that subsequent response/status messages can refer to.</span>
<a name="l00061"></a>00061 <span class="comment">  - \b command is the 2-character AT command.</span>
<a name="l00062"></a>00062 <span class="comment">  - \b parameters is a buffer that holds the value of the AT command.</span>
<a name="l00063"></a>00063 <span class="comment"> */</span>
<a name="l00064"></a><a class="code" href="struct_x_bee___a_t_command.html">00064</a> <span class="keyword">typedef</span> <span class="keyword">struct</span>
<a name="l00065"></a>00065 {
<a name="l00066"></a>00066   uint8 frameID;
<a name="l00067"></a>00067   uint8 command[ 2 ];
<a name="l00068"></a>00068   uint8 parameters[ 97 ];
<a name="l00069"></a>00069 } <a class="code" href="struct_x_bee___a_t_command.html" title="The structure used for a standard AT Command packet.">XBee_ATCommand</a>;
<a name="l00070"></a>00070 <span class="comment"></span>
<a name="l00071"></a>00071 <span class="comment">/** </span>
<a name="l00072"></a>00072 <span class="comment">  The structure used for a response to a standard AT Command packet.</span>
<a name="l00073"></a>00073 <span class="comment">  - \b frameID is the ID that this response is referring to.</span>
<a name="l00074"></a>00074 <span class="comment">  - \b command is the 2-character AT command.</span>
<a name="l00075"></a>00075 <span class="comment">  - \b status is response value - 0 (OK) or 1 (ERROR).</span>
<a name="l00076"></a>00076 <span class="comment">  - \b value is a buffer that holds the value of the AT command response.</span>
<a name="l00077"></a>00077 <span class="comment"> */</span>
<a name="l00078"></a><a class="code" href="struct_x_bee___a_t_command_response.html">00078</a> <span class="keyword">typedef</span> <span class="keyword">struct</span>
<a name="l00079"></a>00079 {
<a name="l00080"></a>00080   uint8 frameID;
<a name="l00081"></a>00081   uint8 command[ 2 ];
<a name="l00082"></a>00082   uint8 status;
<a name="l00083"></a>00083   uint8 value[ 96 ];
<a name="l00084"></a>00084 }  <a class="code" href="struct_x_bee___a_t_command_response.html" title="The structure used for a response to a standard AT Command packet.">XBee_ATCommandResponse</a>;
<a name="l00085"></a>00085 <span class="comment"></span>
<a name="l00086"></a>00086 <span class="comment">/** </span>
<a name="l00087"></a>00087 <span class="comment">  The structure used to transmit an XBee packet with a 64-bit destination address.</span>
<a name="l00088"></a>00088 <span class="comment">  - \b frameID is the ID for this packet that subsequent response/status messages can refer to.</span>
<a name="l00089"></a>00089 <span class="comment">  - \b destination is the 64-bit (8-byte) address of the destination.</span>
<a name="l00090"></a>00090 <span class="comment">  - \b options - 0x01 (disable ACK) or 0x04 (Send with Broadcast PAN ID).</span>
<a name="l00091"></a>00091 <span class="comment">  - \b data is a buffer that holds the value of the outgoing packet.</span>
<a name="l00092"></a>00092 <span class="comment"> */</span>
<a name="l00093"></a><a class="code" href="struct_x_bee___t_x64.html">00093</a> <span class="keyword">typedef</span> <span class="keyword">struct</span>
<a name="l00094"></a>00094 {
<a name="l00095"></a>00095   uint8 frameID;
<a name="l00096"></a>00096   uint8 destination[ 8 ];
<a name="l00097"></a>00097   uint8 options;
<a name="l00098"></a>00098   uint8 data[ 90 ];
<a name="l00099"></a>00099 }  <a class="code" href="struct_x_bee___t_x64.html" title="The structure used to transmit an XBee packet with a 64-bit destination address.">XBee_TX64</a>;
<a name="l00100"></a>00100 <span class="comment"></span>
<a name="l00101"></a>00101 <span class="comment">/** </span>
<a name="l00102"></a>00102 <span class="comment">  The structure used to transmit an XBee packet with a 16-bit destination address.</span>
<a name="l00103"></a>00103 <span class="comment">  - \b frameID is the ID for this packet that subsequent response/status messages can refer to.</span>
<a name="l00104"></a>00104 <span class="comment">  - \b destination is the 16-bit (2-byte) address of the destination.</span>
<a name="l00105"></a>00105 <span class="comment">  - \b options - 0x01 (disable ACK) or 0x04 (Send with Broadcast PAN ID).</span>
<a name="l00106"></a>00106 <span class="comment">  - \b data is a buffer that holds the value of the outgoing packet.</span>
<a name="l00107"></a>00107 <span class="comment"> */</span>
<a name="l00108"></a><a class="code" href="struct_x_bee___t_x16.html">00108</a> <span class="keyword">typedef</span> <span class="keyword">struct</span>
<a name="l00109"></a>00109 {
<a name="l00110"></a>00110   uint8 frameID;
<a name="l00111"></a>00111   uint8 destination[ 2 ];
<a name="l00112"></a>00112   uint8 options;
<a name="l00113"></a>00113   uint8 data[ 96 ];
<a name="l00114"></a>00114 }  <a class="code" href="struct_x_bee___t_x16.html" title="The structure used to transmit an XBee packet with a 16-bit destination address.">XBee_TX16</a>;
<a name="l00115"></a>00115 <span class="comment"></span>
<a name="l00116"></a>00116 <span class="comment">/** </span>
<a name="l00117"></a>00117 <span class="comment">  When a transmit request is completed, the module sends a transmit status message.</span>
<a name="l00118"></a>00118 <span class="comment">  - \b frameID is the ID that this response is referring to.</span>
<a name="l00119"></a>00119 <span class="comment">  - \b status can have values of:</span>
<a name="l00120"></a>00120 <span class="comment">    - 0 - success</span>
<a name="l00121"></a>00121 <span class="comment">    - 1 - No ACK received</span>
<a name="l00122"></a>00122 <span class="comment">    - 2 - CCA failure</span>
<a name="l00123"></a>00123 <span class="comment">    - 3 - Purged</span>
<a name="l00124"></a>00124 <span class="comment"> */</span>
<a name="l00125"></a><a class="code" href="struct_x_bee___t_x_status.html">00125</a> <span class="keyword">typedef</span> <span class="keyword">struct</span>
<a name="l00126"></a>00126 {
<a name="l00127"></a>00127   uint8 frameID;
<a name="l00128"></a>00128   uint8 status;
<a name="l00129"></a>00129 }  <a class="code" href="struct_x_bee___t_x_status.html" title="When a transmit request is completed, the module sends a transmit status message...">XBee_TXStatus</a>;
<a name="l00130"></a>00130 <span class="comment"></span>
<a name="l00131"></a>00131 <span class="comment">/** </span>
<a name="l00132"></a>00132 <span class="comment">  An incoming packet with a 64-bit address.</span>
<a name="l00133"></a>00133 <span class="comment">  - \b source is the 64-bit (8-byte) address of the sender.</span>
<a name="l00134"></a>00134 <span class="comment">  - \b rssi is the signal strength of the received message.</span>
<a name="l00135"></a>00135 <span class="comment">  - \b options - bit 1 is Address Broadcast, bit 2 is PAN broadcast.  Other bits reserved.</span>
<a name="l00136"></a>00136 <span class="comment">  - \b data is a buffer that holds the value of the incoming packet.</span>
<a name="l00137"></a>00137 <span class="comment"> */</span>
<a name="l00138"></a><a class="code" href="struct_x_bee___r_x64.html">00138</a> <span class="keyword">typedef</span> <span class="keyword">struct</span>
<a name="l00139"></a>00139 {
<a name="l00140"></a>00140   uint8 source[ 8 ];
<a name="l00141"></a>00141   uint8 rssi;
<a name="l00142"></a>00142   uint8 options;
<a name="l00143"></a>00143   uint8 data[ 89 ];
<a name="l00144"></a>00144 }  <a class="code" href="struct_x_bee___r_x64.html" title="An incoming packet with a 64-bit address.">XBee_RX64</a>;
<a name="l00145"></a>00145 <span class="comment"></span>
<a name="l00146"></a>00146 <span class="comment">/** </span>
<a name="l00147"></a>00147 <span class="comment">  An incoming packet with a 16-bit address.</span>
<a name="l00148"></a>00148 <span class="comment">  - \b source is the 16-bit (2-byte) address of the sender.</span>
<a name="l00149"></a>00149 <span class="comment">  - \b rssi is the signal strength of the received message.</span>
<a name="l00150"></a>00150 <span class="comment">  - \b options - bit 1 is Address Broadcast, bit 2 is PAN broadcast.  Other bits reserved.</span>
<a name="l00151"></a>00151 <span class="comment">  - \b data is a buffer that holds the value of the incoming packet.</span>
<a name="l00152"></a>00152 <span class="comment"> */</span>
<a name="l00153"></a><a class="code" href="struct_x_bee___r_x16.html">00153</a> <span class="keyword">typedef</span> <span class="keyword">struct</span>
<a name="l00154"></a>00154 {
<a name="l00155"></a>00155   uint8 source[ 2 ];
<a name="l00156"></a>00156   uint8 rssi;
<a name="l00157"></a>00157   uint8 options;
<a name="l00158"></a>00158   uint8 data[ 95 ];
<a name="l00159"></a>00159 }  <a class="code" href="struct_x_bee___r_x16.html" title="An incoming packet with a 16-bit address.">XBee_RX16</a>;
<a name="l00160"></a>00160 <span class="comment"></span>
<a name="l00161"></a>00161 <span class="comment">/** </span>
<a name="l00162"></a>00162 <span class="comment">  An incoming packet with IO data from a 64-bit address.</span>
<a name="l00163"></a>00163 <span class="comment">  - \b source is the 64-bit (8-byte) address of the sender.</span>
<a name="l00164"></a>00164 <span class="comment">  - \b rssi is the signal strength of the received message.</span>
<a name="l00165"></a>00165 <span class="comment">  - \b options - bit 1 is Address Broadcast, bit 2 is PAN broadcast.  Other bits reserved.</span>
<a name="l00166"></a>00166 <span class="comment">  - \b samples - the number of samples in this packet.</span>
<a name="l00167"></a>00167 <span class="comment">  - \b channelIndicators - bit mask indicating which channels have been sampled.</span>
<a name="l00168"></a>00168 <span class="comment">  - \b data is a buffer that holds the IO values as indicated by \b channelIndicators.</span>
<a name="l00169"></a>00169 <span class="comment"> */</span>
<a name="l00170"></a><a class="code" href="struct_x_bee___i_o64.html">00170</a> <span class="keyword">typedef</span> <span class="keyword">struct</span>
<a name="l00171"></a>00171 {
<a name="l00172"></a>00172   uint8 source[ 8 ];
<a name="l00173"></a>00173   uint8 rssi;
<a name="l00174"></a>00174   uint8 options;
<a name="l00175"></a>00175   uint8 samples;
<a name="l00176"></a>00176   uint8 channelIndicators[ 2 ];
<a name="l00177"></a>00177   uint8 data[ 86 ];
<a name="l00178"></a>00178 }  <a class="code" href="struct_x_bee___i_o64.html" title="An incoming packet with IO data from a 64-bit address.">XBee_IO64</a>;
<a name="l00179"></a>00179 <span class="comment"></span>
<a name="l00180"></a>00180 <span class="comment">/** </span>
<a name="l00181"></a>00181 <span class="comment">  An incoming packet with IO data from a 16-bit address.</span>
<a name="l00182"></a>00182 <span class="comment">  - \b source is the 16-bit (2-byte) address of the sender.</span>
<a name="l00183"></a>00183 <span class="comment">  - \b rssi is the signal strength of the received message.</span>
<a name="l00184"></a>00184 <span class="comment">  - \b options - bit 1 is Address Broadcast, bit 2 is PAN broadcast.  Other bits reserved.</span>
<a name="l00185"></a>00185 <span class="comment">  - \b samples - the number of samples in this packet.</span>
<a name="l00186"></a>00186 <span class="comment">  - \b channelIndicators - bit mask indicating which channels have been sampled.</span>
<a name="l00187"></a>00187 <span class="comment">  - \b data is a buffer that holds the IO values as indicated by \b channelIndicators.</span>
<a name="l00188"></a>00188 <span class="comment"> */</span>
<a name="l00189"></a><a class="code" href="struct_x_bee___i_o16.html">00189</a> <span class="keyword">typedef</span> <span class="keyword">struct</span>
<a name="l00190"></a>00190 {
<a name="l00191"></a>00191   uint8 source[ 2 ];
<a name="l00192"></a>00192   uint8 rssi;
<a name="l00193"></a>00193   uint8 options;
<a name="l00194"></a>00194   uint8 samples;
<a name="l00195"></a>00195   uint8 channelIndicators[ 2 ];
<a name="l00196"></a>00196   uint8 data[ 92 ];
<a name="l00197"></a>00197 }  <a class="code" href="struct_x_bee___i_o16.html" title="An incoming packet with IO data from a 16-bit address.">XBee_IO16</a>;
<a name="l00198"></a>00198 
<a name="l00199"></a>00199 <span class="keyword">typedef</span> <span class="keyword">enum</span> 
<a name="l00200"></a>00200 { 
<a name="l00201"></a>00201   XBEE_TX64 = 0x00,
<a name="l00202"></a>00202   XBEE_TX16 = 0x01,
<a name="l00203"></a>00203   XBEE_TXSTATUS = 0x89,
<a name="l00204"></a>00204   XBEE_RX64 = 0x80,
<a name="l00205"></a>00205   XBEE_RX16 = 0x81,
<a name="l00206"></a>00206   XBEE_ATCOMMAND = 0x08,
<a name="l00207"></a>00207   XBEE_ATCOMMANDQ = 0x09,
<a name="l00208"></a>00208   XBEE_ATCOMMANDRESPONSE = 0x88,
<a name="l00209"></a>00209   XBEE_IO64 = 0x82,
<a name="l00210"></a>00210   XBEE_IO16 = 0x83
<a name="l00211"></a>00211 } XBeeApiId;
<a name="l00212"></a>00212 <span class="comment"></span>
<a name="l00213"></a>00213 <span class="comment">/** @}</span>
<a name="l00214"></a>00214 <span class="comment">*/</span>
<a name="l00215"></a>00215 
<a name="l00216"></a>00216 <span class="keyword">typedef</span> <span class="keyword">struct</span>
<a name="l00217"></a>00217 {
<a name="l00218"></a>00218   uint8 apiId;
<a name="l00219"></a>00219   <span class="keyword">union</span>
<a name="l00220"></a>00220   {
<a name="l00221"></a>00221     uint8 payload[ 100 ];
<a name="l00222"></a>00222     <a class="code" href="struct_x_bee___t_x64.html" title="The structure used to transmit an XBee packet with a 64-bit destination address.">XBee_TX64</a> tx64;
<a name="l00223"></a>00223     <a class="code" href="struct_x_bee___t_x16.html" title="The structure used to transmit an XBee packet with a 16-bit destination address.">XBee_TX16</a> tx16;
<a name="l00224"></a>00224     <a class="code" href="struct_x_bee___t_x_status.html" title="When a transmit request is completed, the module sends a transmit status message...">XBee_TXStatus</a> txStatus;
<a name="l00225"></a>00225     <a class="code" href="struct_x_bee___r_x64.html" title="An incoming packet with a 64-bit address.">XBee_RX64</a> rx64;
<a name="l00226"></a>00226     <a class="code" href="struct_x_bee___r_x16.html" title="An incoming packet with a 16-bit address.">XBee_RX16</a> rx16;
<a name="l00227"></a>00227     <a class="code" href="struct_x_bee___a_t_command.html" title="The structure used for a standard AT Command packet.">XBee_ATCommand</a> atCommand;
<a name="l00228"></a>00228     <a class="code" href="struct_x_bee___a_t_command_response.html" title="The structure used for a response to a standard AT Command packet.">XBee_ATCommandResponse</a> atResponse;
<a name="l00229"></a>00229     <a class="code" href="struct_x_bee___i_o64.html" title="An incoming packet with IO data from a 64-bit address.">XBee_IO64</a> io64;
<a name="l00230"></a>00230     <a class="code" href="struct_x_bee___i_o16.html" title="An incoming packet with IO data from a 16-bit address.">XBee_IO16</a> io16;
<a name="l00231"></a>00231   };
<a name="l00232"></a>00232   
<a name="l00233"></a>00233   uint8 crc;
<a name="l00234"></a>00234   uint8 *dataPtr;
<a name="l00235"></a>00235   <span class="keywordtype">int</span> rxState;
<a name="l00236"></a>00236   <span class="keywordtype">int</span> length;
<a name="l00237"></a>00237   <span class="keywordtype">int</span> index;
<a name="l00238"></a>00238 } __attribute__((packed)) XBeePacket;
<a name="l00239"></a>00239 
<a name="l00240"></a>00240 
<a name="l00241"></a>00241 <span class="keywordtype">int</span> <a class="code" href="group___x_bee.html#gf99a020a130eed99733b529b8cdb84a8" title="Controls the active state of the XBee subsystem.">XBee_SetActive</a>( <span class="keywordtype">int</span> state );
<a name="l00242"></a>00242 <span class="keywordtype">int</span> <a class="code" href="group___x_bee.html#gb9837489c49f82e3ca25f0da44c58a13" title="Read the active state of the XBee subsystem.">XBee_GetActive</a>( <span class="keywordtype">void</span> );
<a name="l00243"></a>00243 <span class="keywordtype">int</span> <a class="code" href="group___x_bee.html#gb6f350a2b5dea977c3ab6244e4984833" title="Receive an incoming XBee packet.">XBee_GetPacket</a>( XBeePacket* packet, <span class="keywordtype">int</span> timeout );
<a name="l00244"></a>00244 <span class="keywordtype">int</span> <a class="code" href="group___x_bee.html#g88dd9f12ff38f318e59ec8e8283a78d3" title="Send an XBee packet.">XBee_SendPacket</a>( XBeePacket* packet, <span class="keywordtype">int</span> datalength );
<a name="l00245"></a>00245 <span class="keywordtype">void</span> <a class="code" href="group___x_bee.html#g066e28d0aaafb23eb1171bcdb31e5c45" title="Initialize a packet before reading into it.">XBee_ResetPacket</a>( XBeePacket* packet );
<a name="l00246"></a>00246 
<a name="l00247"></a>00247 <span class="comment">// packet creators and unpackers</span>
<a name="l00248"></a>00248 <span class="keywordtype">bool</span> <a class="code" href="group___x_bee.html#g64d16869ea926373568cc1c09c53b0fa" title="Create a packet to be transmitted with a 16-bit address.">XBee_CreateTX16Packet</a>( XBeePacket* xbp, uint8 frameID, uint16 destination, uint8 options, uint8* data, uint8 datalength );
<a name="l00249"></a>00249 <span class="keywordtype">bool</span> <a class="code" href="group___x_bee.html#gda9cdb29dfffba8aea12c8f9e5586237" title="Create a packet to be transmitted with a 64-bit address.">XBee_CreateTX64Packet</a>( XBeePacket* xbp, uint8 frameID, uint64 destination, uint8 options, uint8* data, uint8 datalength );
<a name="l00250"></a>00250 <span class="keywordtype">bool</span> <a class="code" href="group___x_bee.html#g90063926b2e0055e8476887828e8eaa4" title="Unpack the info from an incoming packet with a 16-bit address.">XBee_ReadRX16Packet</a>( XBeePacket* xbp, uint16* srcAddress, uint8* sigstrength, uint8* options, uint8** data, uint8* datalength );
<a name="l00251"></a>00251 <span class="keywordtype">bool</span> <a class="code" href="group___x_bee.html#g366e1d12df63ac0bb6b4fbf380c9311c" title="Unpack the info from an incoming packet with a 64-bit address.">XBee_ReadRX64Packet</a>( XBeePacket* xbp, uint64* srcAddress, uint8* sigstrength, uint8* options, uint8** data, uint8* datalength  );
<a name="l00252"></a>00252 <span class="keywordtype">bool</span> <a class="code" href="group___x_bee.html#gdc33b8d4803250488422484b2129f659" title="Unpack the info from an incoming IO packet with a 16-bit address.">XBee_ReadIO16Packet</a>( XBeePacket* xbp, uint16* srcAddress, uint8* sigstrength, uint8* options, <span class="keywordtype">int</span>* samples );
<a name="l00253"></a>00253 <span class="keywordtype">bool</span> <a class="code" href="group___x_bee.html#ga54eca4b48efbf8f8080203f9930c1cd" title="Unpack the info from an incoming IO packet with a 64-bit address.">XBee_ReadIO64Packet</a>( XBeePacket* xbp, uint64* srcAddress, uint8* sigstrength, uint8* options, <span class="keywordtype">int</span>* samples );
<a name="l00254"></a>00254 <span class="keywordtype">void</span> <a class="code" href="group___x_bee.html#g2c4ec9c048a04f7d7b46850377e51008" title="A convenience function for creating an AT command packet.">XBee_CreateATCommandPacket</a>( XBeePacket* packet, uint8 frameID, <span class="keywordtype">char</span>* cmd, uint8* params, uint8 datalength );
<a name="l00255"></a>00255 <span class="keywordtype">bool</span> <a class="code" href="group___x_bee.html#gfc6ae9ae046640c29bc29f18d01f9a04" title="Unpack the info from an incoming AT Command Response packet.">XBee_ReadAtResponsePacket</a>( XBeePacket* xbp, uint8* frameID, <span class="keywordtype">char</span>** command, uint8* status, uint8** data );
<a name="l00256"></a>00256 <span class="keywordtype">bool</span> <a class="code" href="group___x_bee.html#ga9d737273a7ae0ab7240424b058fc639" title="Unpack the info from TX Status packet.">XBee_ReadTXStatusPacket</a>( XBeePacket* xbp, uint8* frameID, uint8* status );
<a name="l00257"></a>00257 
<a name="l00258"></a>00258 <span class="comment">// XBee Config stuff</span>
<a name="l00259"></a>00259 <span class="keywordtype">void</span> <a class="code" href="group___x_bee.html#gb3abc9b61091749d5aa7a48e8aa35e18" title="Set a module into packet API mode.">XBeeConfig_SetPacketApiMode</a>( <span class="keywordtype">int</span> value );
<a name="l00260"></a>00260 <span class="keywordtype">int</span> <a class="code" href="group___x_bee.html#g5d8c12d4fba507727eded9aad78f5126" title="Query whether the module is in API mode.">XBeeConfig_RequestPacketApiMode</a>( <span class="keywordtype">void</span> );
<a name="l00261"></a>00261 <span class="keywordtype">void</span> <a class="code" href="group___x_bee.html#g60564c155b8d6a6e73a9bfa54917ebd2" title="Save the configuration changes you&amp;#39;ve made on the module to memory.">XBeeConfig_WriteStateToMemory</a>( <span class="keywordtype">void</span> );
<a name="l00262"></a>00262 <span class="keywordtype">void</span> <a class="code" href="group___x_bee.html#gf6eb50d7c632ccadf35d89bebf30ba4a" title="Set this module&amp;#39;s address.">XBeeConfig_SetAddress</a>( uint16 address );
<a name="l00263"></a>00263 <span class="keywordtype">int</span> <a class="code" href="group___x_bee.html#gcca92909fdf6d844af5da5a13b1d1303" title="Query the address of the module.">XBeeConfig_RequestAddress</a>( <span class="keywordtype">void</span> );
<a name="l00264"></a>00264 <span class="keywordtype">void</span> <a class="code" href="group___x_bee.html#gbb8511090eee4d72a26bf55fb44bcd68" title="Set this PAN (Personal Area Network) ID.">XBeeConfig_SetPanID</a>( uint16 <span class="keywordtype">id</span> );
<a name="l00265"></a>00265 <span class="keywordtype">int</span> <a class="code" href="group___x_bee.html#gd24a98ab72e3e7767982e59ba663c003" title="Query the PAN ID of the module.">XBeeConfig_RequestPanID</a>( <span class="keywordtype">void</span> );
<a name="l00266"></a>00266 <span class="keywordtype">void</span> <a class="code" href="group___x_bee.html#gd5fd4ac5a68e76d7a16b3e685f05a4f8" title="Set the module&amp;#39;s channel.">XBeeConfig_SetChannel</a>( uint8 channel );
<a name="l00267"></a>00267 <span class="keywordtype">int</span> <a class="code" href="group___x_bee.html#ga893d7c545c7b39c0f6909be757751fd" title="Query the channel of the module.">XBeeConfig_RequestChannel</a>( <span class="keywordtype">void</span> );
<a name="l00268"></a>00268 <span class="keywordtype">void</span> <a class="code" href="group___x_bee.html#g35826df514efda2aab33f86cf0e24f2e" title="Set the rate at which the module will sample its IO pins.">XBeeConfig_SetSampleRate</a>( uint16 rate );
<a name="l00269"></a>00269 <span class="keywordtype">int</span> <a class="code" href="group___x_bee.html#g00ce3bb898806b5cf6bb257dfb24ca9c" title="Query the sample rate of the module.">XBeeConfig_RequestSampleRate</a>( <span class="keywordtype">void</span> );
<a name="l00270"></a>00270 <span class="keywordtype">void</span> <a class="code" href="group___x_bee.html#g2a1939254f9174e0ee2c33a4d2ff8ba3" title="Configure the IO settings on an XBee module.">XBeeConfig_SetIO</a>( <span class="keywordtype">int</span> index, <span class="keywordtype">int</span> value );
<a name="l00271"></a>00271 <span class="keywordtype">int</span> <a class="code" href="group___x_bee.html#g471f419a8be85dff56cb190ac1122df3" title="Query the configuration of an IO pin.">XBeeConfig_RequestIO</a>( <span class="keywordtype">int</span> pin );
<a name="l00272"></a>00272 <span class="keywordtype">int</span> <a class="code" href="group___x_bee.html#g2f0a97c1a7ce219eb7ccd807e8a860e2" title="Query the address of the module.">XBeeConfig_RequestATResponse</a>( <span class="keywordtype">char</span>* cmd );
<a name="l00273"></a>00273 
<a name="l00274"></a>00274 <span class="keywordtype">bool</span> XBee_GetAutoSend( <span class="keywordtype">bool</span> init );
<a name="l00275"></a>00275 <span class="keywordtype">void</span> XBee_SetAutoSend( <span class="keywordtype">int</span> onoff );
<a name="l00276"></a>00276 
<a name="l00277"></a>00277 <span class="keywordtype">void</span> <a class="code" href="group___x_bee.html#gd357b57c2604013a69ec60e746318f89" title="Convert a 32-bit integer into a big endian array of 4 unsigned 8-bit integers.">XBee_IntToBigEndianArray</a>( <span class="keywordtype">int</span> value, uint8* array );
<a name="l00278"></a>00278 
<a name="l00279"></a>00279 
<a name="l00280"></a>00280 <span class="comment">// XBee OSC stuff</span>
<a name="l00281"></a>00281 const <span class="keywordtype">char</span>* XBeeOsc_GetName( <span class="keywordtype">void</span> );
<a name="l00282"></a>00282 <span class="keywordtype">int</span> XBeeOsc_ReceiveMessage( <span class="keywordtype">int</span> channel, <span class="keywordtype">char</span>* message, <span class="keywordtype">int</span> length );
<a name="l00283"></a>00283 <span class="keywordtype">int</span> XBeeOsc_Async( <span class="keywordtype">int</span> channel );
<a name="l00284"></a>00284 <span class="keywordtype">int</span> XBeeOsc_HandleNewPacket( XBeePacket* xbp, <span class="keywordtype">int</span> channel );
<a name="l00285"></a>00285 
<a name="l00286"></a>00286 const <span class="keywordtype">char</span>* XBeeConfigOsc_GetName( <span class="keywordtype">void</span> );
<a name="l00287"></a>00287 <span class="keywordtype">int</span> XBeeConfigOsc_ReceiveMessage( <span class="keywordtype">int</span> channel, <span class="keywordtype">char</span>* message, <span class="keywordtype">int</span> length );
<a name="l00288"></a>00288 
<a name="l00289"></a>00289 <span class="preprocessor">#endif // XBEE_H</span>
</pre></div><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Make Controller Kit</title>
<style type="text/css">
<!--
.footer {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 9pt;
	color: #999999;
}
-->
</style>
</head>

<body>
<hr size="1">
<div>
  <p class="footer">The Make Controller Kit is an open source project maintained by <a href="http://www.makingthings.com">MakingThings</a>.<br />
    MakingThings code is released under the <a href="http://www.apache.org/licenses/LICENSE-2.0.html" target="_blank">Apache 2.0 license</a>.<br />
    Bug tracker, development wiki and status can be found at <a href="http://dev.makingthings.com">http://dev.makingthings.com</a>.<br />
		This document was last updated on 5 Dec 2007.
</p>
</div>
<!-- Google Analytics Code -->
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-769030-1";
urchinTracker();
</script>
</body>
</html>
